package models

import (
	"net/http"
	"time"
)

type Cookie struct {
	ID         int64     `gorm:"primaryKey;column:id"`
	Enable     bool      `gorm:"column:enable"`
	Email      string    `gorm:"column:email"`
	Domain     string    `gorm:"column:domain"`
	Name       string    `gorm:"column:name"`
	Value      string    `gorm:"column:value"`
	CreatedAt  time.Time `gorm:"column:created_at"`
	UpdatedAt  time.Time `gorm:"column:updated_at"`
	CreateTime int64     `gorm:"column:create_time"`
	UpdateTime int64     `gorm:"column:update_time"`
}

func (r *Cookie) TableName() string {
	return "yf_g2g_cookie"
}

func (r *Cookie) Cookies() *http.Cookie {
	return &http.Cookie{
		Name:   r.Name,
		Value:  r.Value,
		Domain: r.Domain,
	}
}
